home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / games / worm.zip / WORMLIST.C < prev    next >
C/C++ Source or Header  |  1992-09-21  |  736b  |  52 lines

  1.  
  2. #include "worm.h"
  3.  
  4. RING *h;
  5. RING* InitWormList(void)
  6. {
  7.  RING *t, *p;
  8.  int i;
  9.  POINT point;
  10.  
  11.  point.x = 200; //GetSize();
  12.  point.y = 0; //GetSize();
  13.  
  14.  h = malloc(sizeof(RING));
  15.  h->center = point;
  16.  h->state = INACTIVE;
  17.  h->color = 0;
  18.  h->next = h;
  19.  
  20.  p = h;
  21.  
  22.  for(i = 1; i < GetRings(); i++) {
  23.    t = p;
  24.    p = malloc(sizeof(RING));
  25.     p->center = point;
  26.     p->state = INACTIVE;
  27.     p->color = 0;
  28.     t->next = p;
  29.  }
  30.  
  31.  p->next = h;
  32.  return h;
  33. } /* InitWormList */
  34.  
  35. /* -------------------------------------------------------------------- */
  36.  
  37. void FreeWormList(void)
  38. {
  39.  RING *t, *p;
  40.  int i;
  41.  
  42.  p = h;
  43.  
  44.  for (i=0; i < GetRings(); i++) {
  45.   t = p->next;
  46.   free(p);
  47.   p = t;
  48.  }
  49.  
  50. }
  51.  
  52. /* EOF */